﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using UniUI.ConsoleUI;

namespace UniUI
{
    class Program
    {
        static void Main(string[] args)
        {
            var window = ConsoleWindow.Create();
             
            {
                var field = new ConsoleFieldCtrl(window.MainControl, 6, 20);
                field.LabelGrid.Text = "Text1:";
                field.EditGrid.Text = "Hello World!";
                window.MainControl.AddControl(field);
            }
            {
                var field = new ConsoleFieldCtrl(window.MainControl, 6, 20) { Top = 1 };
                field.LabelGrid.Text = "Text2:";
                field.EditGrid.Text = "Hello World!!";
                window.MainControl.AddControl(field);
            }
            {
                var button = new ConsoleButton(window.MainControl) { Top = 3, Width = 10, Text = "OK" };
                window.MainControl.AddControl(button);
            }
            {
                var button = new ConsoleButton(window.MainControl) { Left = 11, Top = 3, Width = 10, Text = "Exit" };
                button.Triggered += delegate()
                {
                    ConsoleUIManager.Stop();
                };
                window.MainControl.AddControl(button);
            }

            ConsoleUIManager.Window = window;

            ConsoleUIManager.Start();
            while (ConsoleUIManager.IsRunning)
            {
                Thread.Sleep(1000);
            }
        }
    }
}
